<!DOCTYPE HTML>
<html lang="zh_CN">
<head><meta name="generator" content="Hexo 3.8.0">
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable" content="cn華少">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <meta name="browsermode" content="application">
    <meta name="screen-orientation" content="portrait">
    <link rel="dns-prefetch" href="http://cnhuashao.com">
    <!--SEO-->

    <meta name="keywords" content="owncloud">


    <meta name="description" content="本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get install安装，建议查看官网即可快速安装。开始进入正题：一、安装apac...">



<meta name="robots" content="all">
<meta name="google" content="all">
<meta name="googlebot" content="all">
<meta name="verify" content="all">

    <!--Title-->


<title>在ubuntu16.04上安装owncloud | cn華少</title>


    <link rel="alternate" href="/atom.xml" title="cn華少" type="application/atom+xml">


    <link rel="icon" href="/favicon/favicon.ico">

    



<link rel="stylesheet" href="/css/bootstrap.min.css?rev=3.3.7">
<link rel="stylesheet" href="/favicons.css">
<link rel="stylesheet" href="/css/style.css?rev=@@hash">




    
	<div class="hide">
		<script type="text/javascript">
			var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan class='cnzz_stat_icon_1263868967 hide' %3E%3Cscript%20src%3D%22https%3A%2F%2Fs95.cnzz.com%2Fz_stat.php%3Fweb_id%3D1272564536%22%3E%3C%2Fscript%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1263868967%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));
		</script>
	</div>






    

</head>

</html>
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<div style="ie">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->

<body>
    <header class="main-header" style="background-image:url(http://snippet.shenliyang.com/img/banner.jpg)">
    <div class="main-header-box">
        <a class="header-avatar" href="/" title="cn華少">
            <img src="/img/avatar.jpg" alt="logo头像" class="img-responsive center-block">
        </a>
        <div class="branding">
        	<!--<h2 class="text-hide">Snippet主题,从未如此简单有趣</h2>-->
            
                <h2> 追梦，无惧 </h2>
            
    	</div>
    </div>
</header>
    <nav class="main-navigation">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="navbar-header"><span class="nav-toggle-button collapsed pull-right" data-toggle="collapse" data-target="#main-menu" id="mnav">
                    <span class="sr-only"></span>
                        <i class="fa fa-bars"></i>
                    </span>
                    <a class="navbar-brand" href="http://cnhuashao.com">cn華少</a>
                </div>
                <div class="collapse navbar-collapse" id="main-menu">
                    <ul class="menu">
                        
                            <li role="presentation" class="text-center">
                                <a href="/"><i class="fa "></i>首页</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/categories/java/"><i class="fa "></i>Java</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/categories/postgresql/"><i class="fa "></i>PostgreSQL</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/categories/工具/"><i class="fa "></i>工具</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/archives/"><i class="fa "></i>时间轴</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/about/"><i class="fa "></i>关于</a>
                            </li>
                        
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
    <section class="content-wrap">
        <div class="container">
            <div class="row">
                <main class="col-md-8 main-content m-post">
                    <p id="process"></p>
<article class="post">
    <div class="post-head">
        <h1 id="在ubuntu16.04上安装owncloud">
            
	            在ubuntu16.04上安装owncloud
            
        </h1>
        <div class="post-meta">
    
        <span class="categories-meta fa-wrap">
            <i class="fa fa-folder-open-o"></i>
            <a class="category-link" href="/categories/owncloud/">owncloud</a>
        </span>
    

    
        <span class="fa-wrap">
            <i class="fa fa-tags"></i>
            <span class="tags-meta">
                
                    <a class="tag-link" href="/tags/owncloud/">owncloud</a>
                
            </span>
        </span>
    

    
        
        <span class="fa-wrap">
            <i class="fa fa-clock-o"></i>
            <span class="date-meta">2019/04/18</span>
        </span>
        
    
</div>
            
            
    </div>
    
    <div class="post-body post-content">
        <h4 id="本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get-install安装，建议查看官网即可快速安装。开始进入正题："><a href="#本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get-install安装，建议查看官网即可快速安装。开始进入正题：" class="headerlink" title="本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get install安装，建议查看官网即可快速安装。开始进入正题："></a>本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get install安装，建议查看官网即可快速安装。开始进入正题：</h4><h5 id="一、安装apache2环境。"><a href="#一、安装apache2环境。" class="headerlink" title="一、安装apache2环境。"></a>一、安装apache2环境。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install apache2</span><br></pre></td></tr></table></figure>
<h5 id="二、安装php环境与mysql数据库"><a href="#二、安装php环境与mysql数据库" class="headerlink" title="二、安装php环境与mysql数据库"></a>二、安装php环境与mysql数据库</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install php7.0 mysql-server-5.7</span><br></pre></td></tr></table></figure>
<h5 id="三、创建owncloud要使用的数据库用户与相关数据库。"><a href="#三、创建owncloud要使用的数据库用户与相关数据库。" class="headerlink" title="三、创建owncloud要使用的数据库用户与相关数据库。"></a>三、创建owncloud要使用的数据库用户与相关数据库。</h5><a id="more"></a>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql -uroot -p</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">CREATE DATABASE IF NOT EXISTS owncloud;</span><br><span class="line">GRANT ALL PRIVILEGES ON owncloud.* TO &apos;owncloud&apos;@&apos;localhost&apos; IDENTIFIED BY &apos;123456&apos;;</span><br></pre></td></tr></table></figure>
<h5 id="四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。"><a href="#四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。" class="headerlink" title="四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。"></a>四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install apache2 libapache2-mod-php7.0 php7.0-gd php7.0-mysql php7.0-curl php7.0-intl php7.0-mcrypt php-imagick php7.0-zip php7.0-xml php7.0-mbstring</span><br></pre></td></tr></table></figure>
<h5 id="五、下载owncloud安装包。"><a href="#五、下载owncloud安装包。" class="headerlink" title="五、下载owncloud安装包。"></a>五、下载owncloud安装包。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https://download.owncloud.org/community/owncloud-10.0.3.tar.bz2</span><br></pre></td></tr></table></figure>
<h5 id="六、开始解压owncloud"><a href="#六、开始解压owncloud" class="headerlink" title="六、开始解压owncloud"></a>六、开始解压owncloud</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo tar xjf owncloud-10.0.3.tar.bz2</span><br></pre></td></tr></table></figure>
<h5 id="七、将owncloud放入apache2中。"><a href="#七、将owncloud放入apache2中。" class="headerlink" title="七、将owncloud放入apache2中。"></a>七、将owncloud放入apache2中。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cp -r -v owncloud/ /var/www/html/</span><br></pre></td></tr></table></figure>
<h5 id="八、开始创建owncloud用户存储目录。"><a href="#八、开始创建owncloud用户存储目录。" class="headerlink" title="八、开始创建owncloud用户存储目录。"></a>八、开始创建owncloud用户存储目录。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd /var/www/html/owncloud/</span><br><span class="line">sudo mkdir data</span><br></pre></td></tr></table></figure>
<h5 id="九、更改owncloud目录中相关目录权限"><a href="#九、更改owncloud目录中相关目录权限" class="headerlink" title="九、更改owncloud目录中相关目录权限"></a>九、更改owncloud目录中相关目录权限</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo chown -R www-data:www-data data</span><br><span class="line">sudo chown -R www-data:www-data config</span><br><span class="line">sudo chown -R www-data:www-data apps</span><br></pre></td></tr></table></figure>
<h5 id="十、配置apache2"><a href="#十、配置apache2" class="headerlink" title="十、配置apache2"></a>十、配置apache2</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/apache2/apache2.conf</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&lt;Directory /var/www/&gt;  </span><br><span class="line">        Options Indexes FollowSymLinks  </span><br><span class="line">        AllowOverride All  </span><br><span class="line">        Require all granted  </span><br><span class="line">&lt;/Directory&gt;</span><br></pre></td></tr></table></figure>
<h5 id="十一、重启相关服务"><a href="#十一、重启相关服务" class="headerlink" title="十一、重启相关服务"></a>十一、重启相关服务</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo service apache2 restart  </span><br><span class="line">sudo a2enmod rewrite  </span><br><span class="line">sudo a2enmod headers  </span><br><span class="line">sudo service apache2 restart</span><br></pre></td></tr></table></figure>
<h5 id="十二、使用浏览器进行初始化owncloud，开始正常使用owncloud"><a href="#十二、使用浏览器进行初始化owncloud，开始正常使用owncloud" class="headerlink" title="十二、使用浏览器进行初始化owncloud，开始正常使用owncloud"></a>十二、使用浏览器进行初始化owncloud，开始正常使用owncloud</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">http://127.0.0.1/owncloud</span><br></pre></td></tr></table></figure>
    </div>
    
        <div class="reward" ontouchstart>
    <div class="reward-wrap">赏
        <div class="reward-box">
            
                <span class="reward-type">
                    <img class="alipay" src="/img/alipay.jpg"><b>支付宝打赏</b>
                </span>
            
            
                <span class="reward-type">
                    <img class="wechat" src="/img/wepay.jpg"><b>微信打赏</b>
                </span>
            
        </div>
    </div>
    <p class="reward-tip">赞赏是不耍流氓的鼓励</p>
</div>


    
    <div class="post-footer">
        <div>
            
                转载声明：商业转载请联系作者获得授权,非商业转载请注明出处 © <a href target="_blank">Snippet</a>
            
        </div>
        <div>
            
        </div>
    </div>
</article>

<div class="article-nav prev-next-wrap clearfix">
    
        <a href="/2019/04/18/tomcat-init-apr/" class="pre-post btn btn-default" title="在Ubuntu16.04 Server中安装tomcat9+jdk1.8+apr">
            <i class="fa fa-angle-left fa-fw"></i><span class="hidden-lg">上一篇</span>
            <span class="hidden-xs">在Ubuntu16.04 Server中安装tomcat9+jdk1.8+apr</span>
        </a>
    
    
        <a href="/2019/04/18/owncloud-sslpeizhi/" class="next-post btn btn-default" title="使用namecheap证书进行配置htmls安全访问">
            <span class="hidden-lg">下一篇</span>
            <span class="hidden-xs">使用namecheap证书进行配置htmls安全访问</span><i class="fa fa-angle-right fa-fw"></i>
        </a>
    
</div>


    <div id="comments">
        
	
    <div id="vcomments" class="valine"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="/assets/valine.min.js"></script>

    <script>
        new Valine({
            av: AV,
            el: '#vcomments',
            appId: 'xOKV9J4UeQAtVkvnJC7Kq2Jn-gzGzoHsz',
            appKey: 'erIpQac4azoCmgfBB7Dl9maa',
            placeholder: '说点什么吧',
            notify: false,
            verify: false,
            avatar: 'mm',
            meta: 'nick,mail'.split(','),
            pageSize: '10',
            path: window.location.pathname,
            lang: 'zh_CN'.toLowerCase()
        })
    </script>


    </div>





                </main>
                
                    <aside id="article-toc" role="navigation" class="col-md-4">
    <div class="widget">
        <h3 class="title">Table of Contents</h3>
        
            <ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get-install安装，建议查看官网即可快速安装。开始进入正题："><span class="toc-text">本次进行搭建一个owncloud云盘环境，其官方提供了多种安装方式，本次采用压缩包进行手动安装，如果想apt-get install安装，建议查看官网即可快速安装。开始进入正题：</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#一、安装apache2环境。"><span class="toc-text">一、安装apache2环境。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#二、安装php环境与mysql数据库"><span class="toc-text">二、安装php环境与mysql数据库</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#三、创建owncloud要使用的数据库用户与相关数据库。"><span class="toc-text">三、创建owncloud要使用的数据库用户与相关数据库。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。"><span class="toc-text">四、完善owncloud需要的基础环境，原则上之前已经安装过apache2和php环境应该不会出问题，以防万一进行全面安装一次。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#五、下载owncloud安装包。"><span class="toc-text">五、下载owncloud安装包。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#六、开始解压owncloud"><span class="toc-text">六、开始解压owncloud</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#七、将owncloud放入apache2中。"><span class="toc-text">七、将owncloud放入apache2中。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#八、开始创建owncloud用户存储目录。"><span class="toc-text">八、开始创建owncloud用户存储目录。</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#九、更改owncloud目录中相关目录权限"><span class="toc-text">九、更改owncloud目录中相关目录权限</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#十、配置apache2"><span class="toc-text">十、配置apache2</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#十一、重启相关服务"><span class="toc-text">十一、重启相关服务</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#十二、使用浏览器进行初始化owncloud，开始正常使用owncloud"><span class="toc-text">十二、使用浏览器进行初始化owncloud，开始正常使用owncloud</span></a></li></ol></li></ol>
        
    </div>
</aside>

                
            </div>
        </div>
    </section>
    <footer class="main-footer">
    <div class="container">
        <div class="row">
        </div>
    </div>
</footer>

<a id="back-to-top" class="icon-btn hide">
	<i class="fa fa-chevron-up"></i>
</a>




    <div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="busuanzi">
    
</div>

            </div>
            <div class="col-sm-12">
                <span>Copyright &copy; 2017
                </span> |
                <span>
                    Powered by <a href="//hexo.io" class="copyright-links" target="_blank" rel="nofollow">Hexo</a>
                </span> |
                <span>
                    Theme by <a href="//github.com/shenliyang/hexo-theme-snippet.git" class="copyright-links" target="_blank" rel="nofollow">Snippet</a>
                </span>
            </div>
        </div>
    </div>
</div>







<script src="/js/app.js?rev=@@hash"></script>

</body>
</html>